﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Layouts/List.Master" CodeBehind="DeliveredSelect.aspx.cs" Inherits="Bingosoft.WebApp.Modules.DeliveredManager.DeliveredSelect" %>


<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
    <!-- title -->    
    <style type="text/css">
        .menu
        {
            width:53px;
            position: relative;
            height: 23px;
            display:inline;
            margin-top:5px;
        }
        .menu ul
        {
            display: none;
            position: absolute;
            top: 26px;
            right: 0px;
            background-color: #FFF;
            border: 1px solid #30A5FF;
            width: 125px;
            margin: 0;
            padding: 0;
            z-index: 10000;
            float: right;
        }
        .menu ul li
        {
            width: 100%;
            overflow: hidden;
            list-style-type: none;
            height: 18px;
            line-height: 18px;
            vertical-align: middle;
            cursor: pointer;
            text-align: left;
        }
        .menu ul li span
        {
            display: block;
            padding-left: 8px;
        }
        .menu ul li.line
        {
            height: 1px;
            line-height: 1px;
            border-top: 1px solid #AAA;
            width: 90%;
            margin: auto;
            text-align: center;
        }
    </style>
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
<iframe id="download" name="download" src='DeliveredSelect.aspx?Type=<%=Request["Type"] %>' style="display:none;"></iframe>
    <!-- 搜索框 -->
	<div class="search" style="margin-top:2px;">
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
			        <tr>
                        <th>
                            入库开始日期：
                        </th>
                        <td>
                            <web:DatePicker ID="dpCreateDtStart" Name="beginTime" runat="server" DateTimeFormat="yyyy-MM-dd"
                                validator="required"></web:DatePicker>
                        </td>
                        <th>
                            入库结束日期：
                        </th>
                        <td>
                            <web:DatePicker ID="dpCreateDtEnd" Name="endTime" runat="server" DateTimeFormat="yyyy-MM-dd"
                                validator="required"></web:DatePicker>
                        </td> 
                        <th>
                            物资编号：
                        </th>
                        <td>
                            <asp:TextBox ID="txtMaterialsNo" name="MaterialsNo" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>                                     
                    </tr>
                    <tr>
                        <th>
                            物资名称：
                        </th>
                        <td>
                            <asp:TextBox ID="txtMaterialsName" name="MaterialsName" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>
                        <th>
                            物资规格（型号）：
                        </th>
                        <td>
                            <asp:TextBox ID="txtMaterialsModel" name="MaterialsModel" CssClass="txtSelect" runat="server"></asp:TextBox>
                     
                        </td>
                        <th>
                           
                        </th>
                        <td>
                           
                        </td>
                    </tr>
                         <tr>
                      <th>
                            架子：
                        </th>
                        <td>
                            <asp:TextBox ID="txtFrame" name="Frame" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>
                          <th>
                            层：
                        </th>
                        <td>
                            <asp:TextBox ID="txtLevel" name="Level" CssClass="txtSelect" runat="server"></asp:TextBox>
                             <asp:TextBox ID="txtOrgId" name="OrgId" CssClass="txtSelect" Visible="false" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                </table>
            </SearchConditionTemplate>                      
        </web:search>        
    </div>

    <div class="datalist">
	    <!-- 标题头 -->
	    <h2 style="height:30px;">
				 <%= this.titleStr %>
	    </h2>
	    <!-- 工具栏 -->
	    <div class="toolbar"  style="height:30px;">
         <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButtonExport_Click" OnClientClick="return beforeExport();">
                <span>
                    <img id="Img2" alt="" runat="server" src="~/Images/icon_excel.gif" style="border: 0px" />导出
                </span>
            </asp:LinkButton>

	    </div>
	    <div class="datagrid"  style="clear:left;">    

            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="MaterialsNo" DataSourceID="SmartDataSource1" PageSize="10" onrowdatabound="SmartGridView1_RowDataBound">
                <Columns>  
                 
                    <asp:BoundField DataField="MaterialsNo" HeaderText="物资编号" SortExpression="MaterialsNo" ItemStyle-HorizontalAlign="left" />
                    <asp:BoundField DataField="MaterialsName" HeaderText="物资名称"  ItemStyle-HorizontalAlign="center" SortExpression="MaterialsName"/>
                     <asp:BoundField DataField="Frame" HeaderText="架子" SortExpression="Frame" ItemStyle-HorizontalAlign="left" />
                    <asp:BoundField DataField="Level" HeaderText="层"  ItemStyle-HorizontalAlign="center" SortExpression="Level"/>
                    <asp:BoundField DataField="StorageNum" HeaderText="入库数量" ItemStyle-HorizontalAlign="left" SortExpression="StorageNum" />
                    <asp:BoundField DataField="Price" HeaderText="单价" ItemStyle-HorizontalAlign="left" SortExpression="Price"/>
                    <asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ibtnEdit" runat="server" ToolTip="选中" _KeyId='<%#Eval("MaterialsNo")%>'
                                            ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'Insert');"  OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="Storage.select.list1" SelectCountCommand="Storage.select.list1.count"
            SelectCommandAutoPageWrap="true" DefaultSortExpression="MaterialsNo desc">       
                        
            </web:SmartSqlDataSource>
        </div>
	</div>

    <script type="text/javascript">
        $(function () {
            //01.初始化类型
            var t = '<% =this.Type%>';
            $("input[id$='txtType']").val(t);
            

        })
        function openEditor(_this, action) {
            var url = "DeliveredEdit.aspx";

            // FormViewMode : Insert/Edit/ReadOnly
            var params = { FormViewMode: action }
            if (action == "Insert") {
                params.title = '新建' + '<% =this.titleStr%>';
                params.Id = _this.attributes["_KeyId"].value;
                params.Type = '<% =this.Type%>';
            } 

            var returnValue = showCenterModalDialog(buildUrl(url, params), 800, 350);
            if (returnValue == "true") {
                return true;
            }
            return false;
        }

        //模态对话框中下载必须将base的target值指向其他页面
        function beforeExport() {
            $("base").attr("target", "download");
            return true;
        }

    </script>
</asp:Content>
